<@_content id=id>
	<#assign a=object/>
	<#if object.parentId??><#assign parentId=object.parentId/></#if>
	<#assign categoryId=a.categoryId/><#assign modelId=a.modelId/>
	<#assign contentAttr=getContentAttr(object.id)!/>
	<#if contentAttr??&&contentAttr.data?has_content><#assign extendData=contentAttr.data?eval/></#if>
</@_content>
<@_category id=categoryId!><#assign category=object/></@_category>
<@_model id=modelId!><#assign model=object/></@_model>
<script>
function addTag($id,$name){
	if($id&&$name){
		$('#tags',navTab.getCurrentPanel()).append("<span><a href=\"javascript:;\" onclick=\"$(this).parent().remove();return false;\">"+$name+"</a><input type=\"hidden\" name=\"tagIds\" value=\""+$id+"\"/></span>");
	}else if($name){
		$('#tags',navTab.getCurrentPanel()).append("<span><a href=\"javascript:;\" onclick=\"$(this).parent().remove();return false;\">"+$name+"</a><input type=\"hidden\" name=\"tagTitles\" value=\""+$name+"\"/></span>");
	}
	$('input[name=tagId]',navTab.getCurrentPanel()).val('');
	$('input[name=tagTitle]',navTab.getCurrentPanel()).val('')
}
</script>
<style>
#tags span{margin:2px 5px;padding:2px;border:1px solid #aaa;}
</style>
<div class="pageContent">
	<form method="post" action="cmsContent/save.do?callbackType=closeCurrent&navTabId=${queryNavTabId!}" class="pageForm required-validate" onsubmit="return validateCallback(this,navTabAjaxDone);">
		<input name="id" type="hidden" value="${id!}" />
		<input name="parentId" type="hidden" value="${parentId!}" />
		<div class="pageFormContent" layoutH="57">
		<#if parentId?has_content>
			<dl class="nowrap">
				<dt>父<@t.m 'moudle.content'/>：</dt>
				<dd>
					<@_content id=parentId>${object.title}</@_content>
				</dd>
			</dl>
		</#if>
			<dl>
				<dt>分类：</dt>
				<dd>
					<input name="categoryId" type="hidden" value="${categoryId!}"/>
					<input class="required" readonly="readonly" name="categoryName" type="text" size="10" value="${(category.name)!}"/>
				</dd>
			</dl>
			<dl>
				<dt><@t.m 'moudle.model'/>：</dt>
				<dd>
					<input name="modelId" type="hidden" value="${modelId!}"/>
					<input class="required" readonly="readonly" name="modelName" type="text" size="10" value="${(model.name)!}"/>
				</dd>
			</dl>
			<dl class="nowrap">
				<dt><@t.m 'field.title'/>：</dt>
				<dd>
					<input class="required" name="title" type="text" maxlength="255" size="60" value="${(a.title)!}"/>
					<label><input name="isCopied" type="checkbox" onclick="if($(this).is(':checked')){$('.isCopied').show();}else{$('.isCopied').hide();$('.isCopied input[type=text]',navTab.getCurrentPanel()).val('');}"/>转载</label>
				</dd>
			</dl>
			<dl class="isCopied" style="display:none">
				<dt>来源：</dt>
				<dd><input name="source" type="text" maxlength="50" size="20" value="${(a.source)!}"/></dd>
			</dl>
			<dl class="isCopied" style="display:none">
				<dt>来源网址：</dt>
				<dd><input class="url" name="sourceUrl" type="text" maxlength="255" size="20" value="${(a.sourceUrl)!}"/></dd>
			</dl>
		<#if a??&&a.isCopied>
			<script>
				$('input[name=isCopied]',navTab.getCurrentPanel()).click();
			</script>
		</#if>
			<dl>
				<dt>作者：</dt>
				<dd><input name="author" type="text" maxlength="50" size="20" value="${(a.author)!}"/></dd>
			</dl>
			<dl>
				<dt>编辑：</dt>
				<dd><input name="editor" type="text" maxlength="50" size="20" value="${(a.editor)!}"/></dd>
			</dl>
		<#if model??&&model.isUrl>
			<dl class="nowrap">
				<dt>网址：</dt>
				<dd><input name="url" type="text" maxlength="255" style="width: 100%;" value="${(a.url)!}"/></dd>
			</dl>
		</#if>
			<dl class="nowrap">
				<dt>标签(点击删除):</dt>
				<dd id="tags">
				</dd>
			</dl>
			<dl class="nowrap">
				<dt>新增标签：</dt>
				<dd>
					<input name="tagId" type="hidden"/>
					<input name="tagTitle" type="text" size="30" postField="name" suggestfields="tagId,tagTitle,tagType" suggestUrl="cmsTag/suggest.html?categoryId=${categoryId!}"/>
					<a class="buttonActive" href="javascript:;" onclick="addTag($('input[name=tagId]',navTab.getCurrentPanel()).val(),$('input[name=tagTitle]',navTab.getCurrentPanel()).val());return false;"><span>增加</span></a>
				</dd>
			</dl>
	<#if a??>
		<@_tag ids=a.tags!>
		<script>
			<#list map?keys as k>
				addTag('${k}','${map[k].name}');
			</#list>
		</script>
		</@_tag>
	</#if>
			<dl class="nowrap">
				<dt>描述：</dt>
				<dd><textarea name="description" maxlength="300" style="width: 100%;" rows="5">${(a.description)!}</textarea></dd>
			</dl>
	<#if model??&&!model.isUrl>
		<#if model.isPart>
			<#include "../include_page/parts.html"/>
		<#elseif model.isImages>
			<#include "../include_page/images.html"/>
		<#else>
			<dl class="nowrap">
				<dt>正文：</dt>
				<dd style="width:80%">
					<textarea name="txt" class="required editor" style="width: 100%;" rows="20">${(contentAttr.text?html)!}</textarea>
				</dd>
			</dl>
		</#if>
	</#if>
			<dl>
				<dt>定时发布：</dt>
				<dd>
					<input name="timing" type="checkbox" onclick="if($(this).is(':checked')){$('#publishDate').show();$('input[name=publishDate]',navTab.getCurrentPanel()).addClass('required').addClass('valid')}else{$('#publishDate').hide();$('input[name=publishDate]',navTab.getCurrentPanel()).removeClass('required').removeClass('valid')}"/>
				</dd>
			</dl>
			<dl id="publishDate" style="display:none">
				<dt><@t.m 'field.publishDate'/>：</dt>
				<dd>
					<input class="date" name="publishDate" type="text" size="20" dateFmt="yyyy-MM-dd HH:mm:ss" value="${(a.publishDate)!}"/>
					<a class="inputDateButton" href="javascript:;">选择</a>
				</dd>
			</dl>
		<#if a??&&a.publishDate gt .now>
			<script>
				$('input[name=timing]',navTab.getCurrentPanel()).click();
			</script>
		</#if>
			<dl class="nowrap">
				<dt>封面：</dt>
				<dd>
					<input name="cover" value="${(a.cover)!}" maxlength="300" size="40" type="text"/>
					<a class="btnAttach" href="file/upload.html?field=cover" lookupGroup="" width="560" height="300" title="<@t.m 'field.attach'/>"><@t.m 'field.attach'/></a>
					<div id="preview" style="position:relative;"><div style="position:absolute;top:24px;left:0;z-index:1000;"><img style="max-height:400px;max-width:500px;"/></div></div>
					<script>
						$('input[name=cover]',navTab.getCurrentPanel()).hover(function(){
							$('#preview',navTab.getCurrentPanel()).show().find('img').attr('src','${getUploadPath("")}'+$(this).val());
						},function(){
							$('#preview',navTab.getCurrentPanel()).hide();
						});
					</script>
				</dd>
			</dl>
<#if !parentId?has_content&&categoryId?has_content>
	<@_extendList itemType=2 itemId=categoryId extendType=1>
		<#include "../include_page/extend.html"/>
	</@_extendList>
</#if>
<#if modelId?has_content>
	<@_extendList itemType=1 itemId=modelId extendType=1>
		<#include "../include_page/extend.html"/>
	</@_extendList>
</#if>
		</div>
		<div class="formBar">
			<ul>
				<li>
					<label><input type="checkbox" name="draft" />保存为草稿</label>
				</li>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit"><@t.m 'button.save'/></button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close"><@t.m 'button.cancel'/></button></div></div></li>
			</ul>
		</div>
	</form>
</div>